#!/bin/bash

echo '开放端口'
# mysql
firewall-cmd --zone=public --add-port=3306/tcp --permanent
# nacos
firewall-cmd --zone=public --add-port=8848/tcp --permanent
firewall-cmd --zone=public --add-port=9848/tcp --permanent
# seata
firewall-cmd --zone=public --add-port=7091/tcp --permanent
firewall-cmd --zone=public --add-port=8091/tcp --permanent

firewall-cmd --reload

# 主机ip
ip=$(ip addr | grep ens | awk -F ' ' 'NR==2{print $2}' | awk -F '/' '{print $1}')
echo "修改 seata 配置文件 主机ip为: $ip"
sed -i "/^SEATA_IP=/c SEATA_IP=$ip" ./env/seata.env

echo '启动容器'
docker-compose up -d

echo '查看容器'
docker-compose ps
